# -*- coding:utf-8 -*-
import xadmin
from xadmin import views

from .models import EmailVerifyRecord, Banner, Advertisement


class BaseSetting(object):
    enable_themes = True
    use_bootswatch = True


class GlobaSettinhs(object):
    site_title = u'学厨网后台管理系统'
    site_footer = u'郑州大学'
    menu_style = 'accordion'


class EmailVerifyRecordAdmin(object):
    list_display = ['code', 'email', 'send_type', 'send_time']
    search_fields = ['code', 'email', 'send_type']
    list_filter = ['code', 'email', 'send_type', 'send_time']


class BannerAdmin(object):
    list_display = ['title', 'index']


class AdvertisementAdmin(object):
    list_display = ['title', 'priority', 'add_time']
    search_fields = ['title']
    list_filter = ['title', 'priority', 'add_time']


xadmin.site.register(EmailVerifyRecord, EmailVerifyRecordAdmin)
xadmin.site.register(Banner, BannerAdmin)
xadmin.site.register(views.BaseAdminView, BaseSetting)
xadmin.site.register(views.CommAdminView, GlobaSettinhs)
xadmin.site.register(Advertisement, AdvertisementAdmin)